package com.momo.hotel.service.impl;

import com.momo.hotel.dao.mapping.TbShopCarMapper;
import com.momo.hotel.dao.mapping.ext.TbShopCarMapperExt;
import com.momo.hotel.dao.pojo.TbShopCar;
import com.momo.hotel.dao.pojo.ext.TbShopCarExt;
import com.momo.hotel.service.ShopCarService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author qiang
 * @create 2019/7/6
 */
@Service
public class ShopCarServiceImpl implements ShopCarService {

    @Resource
    TbShopCarMapperExt tbShopCarMapperExt;
    @Resource
    TbShopCarMapper tbShopCarMapper;
    /**
     * 获取购物车信息
     * @param userId
     * @return
     */
    @Override
    public List<TbShopCarExt> selectShopCar(Integer userId) {
        return tbShopCarMapperExt.selectShopCar(userId);
    }

    /**
     * 根据id删除购物车
     * @param id
     * @return
     */
    @Override
    public Integer deleteShopCar(Integer id) {
        return tbShopCarMapperExt.deleteShopCar(id);
    }

    @Override
    public Integer addShopCar(TbShopCar tbShopCar) {
        return tbShopCarMapper.insert(tbShopCar);
    }
}
